package com.example.asuper.check;

import android.content.Context;

import com.example.asuper.check.Model.CheckModel;

import java.util.ArrayList;
import java.util.Date;

/**
 * Created by Super on 2015/12/24.
 */
public class CheckModelLab {
    private ArrayList<CheckModel> mCheckModels;
    private static CheckModelLab sCheckModelLab;
    private Context mContext;

    private CheckModelLab(Context context) {
        mContext = context;
        mCheckModels = new ArrayList<CheckModel>();
        Date currentDate=new Date();
//        for (int i=0;i<20;i++){
//            CheckModel checkModel=new CheckModel();
//            checkModel.setCheckCode(currentDate.getYear()+""+currentDate.getMonth()+""+currentDate.getDay()+""+i);
//            checkModel.setCheckName("物品"+i);
//            checkModel.setState((i%2)+"");
//            checkModel.setRemark("备注"+i);
//            mCheckModels.add(checkModel);
//        }
    }

    public static CheckModelLab get(Context c) {
        if (sCheckModelLab == null) {
            sCheckModelLab = new CheckModelLab(c.getApplicationContext());
        }
        return sCheckModelLab;
    }

    public ArrayList<CheckModel> getCheckModels() {
        return mCheckModels;
    }

    public CheckModel getCheckModel(String checkCode){
        for (CheckModel c:mCheckModels){
            if (c.getCheckCode().equals(checkCode)){
                return c;
            }
        }
        return null;
    }

}
